﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ShieldEmojiInputField : InputField
{
    void Awake()
    {
        onValidateInput += _onValidateInput;
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    char MyValidate(char addedChar)
    {
        var res = EmojiTranslate.CheckIsUnicode(addedChar);
        return res;
    }

    char _onValidateInput(string input, int charIndex, char addedChar)
    {
        if(characterLimit != 0 && System.Text.Encoding.UTF8.GetBytes(input + addedChar).Length > characterLimit){
            return '\0';
        }
        return MyValidate(addedChar);
    }
}
